package com.ruoyi.common.enums;

import com.ruoyi.common.utils.StringUtils;

import java.util.Arrays;

public enum JobTypeInitEnum {

    HOISTING_SECURITY_JOB_BILL(1, "吊装安全作业票", "无"),

    HOT_WORK_SECURITY_JOB_BILL(2, "动火安全作业票", "无"),

    GROUNDBREAKING_SECURITY_JOB_BILL(3, "高处安全作业票", "无"),

    RADIAL_SECURITY_JOB_BILL(4, "动土安全作业票", "无"),

    OPEN_CIRCUIT_SECURITY_JOB_BILL(5, "临时用电安全作业票", "无"),

    HIGH_SECURITY_JOB_BILL(6, "动用射线安全作业票", "无"),

    TEMPORARY_ELECTRIC_SECURITY_JOB_BILL(7, "断路安全作业票", "无"),

    BLIND_PLATE_SECURITY_JOB_BILL(8, "盲板抽堵安全作业票", "无"),

    OPENING_SECURITY_JOB_BILL(9, "设备开孔安全作业票", "无"),

    LIMITED_SECURITY_JOB_BILL(10, "受限空间安全作业票", "无"),
    ;

    private Integer code;
    private String desc;
    private String node;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getNode() {
        return node;
    }

    public void setNode(String node) {
        this.node = node;
    }

    JobTypeInitEnum(Integer code, String desc, String node) {
        this.code = code;
        this.desc = desc;
        this.node = node;
    }

    public static JobTypeInitEnum valueOfCode(Integer code) {
        return Arrays.stream(values()).filter(status -> status.getCode().equals(code)).findFirst().orElse(null);
    }

    public static String valueOfDesc(int code) {
        JobTypeInitEnum jobTypeEnum = Arrays.stream(values()).filter(status -> status.getCode()==code).findFirst().orElse(null);

        return jobTypeEnum != null ? jobTypeEnum.getDesc() : null;
    }
}
